package com.wangp.mywrite.inwork.juc;

import lombok.extern.slf4j.Slf4j;

/***
 * @author wangpeng
 * @since 2022-03-10  14:16
 */
@Slf4j
public class ThreadHandler {

    public static void multiplyThreadStartThenJoin(Thread... threads) {
        multiplyThreadStart(threads);
        multiplyThreadJoin(threads);
    }


    public static void multiplyThreadStart(Thread... threads) {
        for (Thread thread : threads) {
            thread.start();
        }
    }

    public static void multiplyThreadJoin(Thread... threads) {
        for (Thread thread : threads) {
            try {
                thread.join();
            } catch (Exception e) {
                log.error("join occur error!");
            }
        }
    }
}
